<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--<img src="/code1">-->
<div id="loginFrom">
    <img src="" id="code">
</div>
</body>
<script src="jquery.js"></script>
<script>
    var timer=null;
    var ticker=null;
    $(function () {
        $.ajax({
            url: "/code2",
            success: function (res) {
                console.log("123456")
                $("#code").attr("src", res.url)
                ticker=res.ticker;
            }
        })
        timer= setInterval('checkLogin()',2000);
    })

    function checkLogin() {
        $.ajax({
            url: "/checkLogin",
            data: "ticker=" + ticker,
            success: function (res) {
                if (res.status == "login") {
                    console.log(res.user)
                    $("#loginFrom").html(res.user)
                    clearInterval(timer)
                }
            }
        })
    }
</script>
</html>